#include <iostream>
using namespace std;

int main()
{
   int iCaseTimes, i, j;
   char Input[1000];
   int iLength;
   int iCount;
   cin>>iCaseTimes;
   gets(Input);
   for(i = 0; i < iCaseTimes; i++)
   {
       gets(Input);
       iCount = 0;
       iLength = strlen(Input);

       iCount = 0;
       for(j = 0; j < iLength; j++)
       {
           if(Input[j] < 0)
           {
               iCount++;
           }
       }

       cout << iCount / 2<< endl;
   }
   return 0;
}